/*
 *  Agent.cpp
 *  MilovoMg00
 *
 *  Created by jonny on 6/8/06.
 *  Copyright 2006 __MyCompanyName__. All rights reserved.
 *
 */

#include "Agent.h"

Agent::Agent() {
	ID = 0;
	Goal = 0;
	FlagGoalDone = true;
	Activity = 0.0;
	NumTimeSelected = 0;
	NumInnovationSucceded = 0;
	NumInnovationFailed = 0;
	NumProjectsSucceded = 0;
	NumProjectsFailed = 0;
	NumInnovationSuccededWithPartner = 0;
	NumInnovationFailedWithPartner = 0;
	IDTempRequest = 0;
	BornStep = 0;
}

Agent::Agent(Mil_Int tmpID, Mil_Double tmpActivity, Mil_Int tmpBornStep)
{
	ID = tmpID;
	Activity = tmpActivity;
	Goal = 0;
	FlagGoalDone = true;
	NumTimeSelected = 0;
	NumInnovationSucceded = 0;
	NumInnovationFailed = 0;
	NumProjectsSucceded = 0;
	NumProjectsFailed = 0;
	NumInnovationSuccededWithPartner = 0;
	NumInnovationFailedWithPartner = 0;
	IDTempRequest = 0;
	BornStep = tmpBornStep;
}

Agent::Agent(Mil_Int tmpID, Mil_Double tmpActivity, Mil_Int tmpGoal, Mil_Int tmpNumInnovationSucceded,
		Mil_Int tmpNumInnovationFailed, Mil_Int tmpNumProjectsSucceded, Mil_Int tmpNumProjectsFailed,
		Mil_Int tmpNumTimeSelected, Mil_Int tmpNumInnovationSuccededWithPartner, 
		Mil_Int tmpNumInnovationFailedWithPartner, Mil_Int tmpBornStep)
{
	ID = tmpID;
	Activity = tmpActivity;
	Goal = tmpGoal;
	FlagGoalDone = true;
	NumInnovationSucceded = tmpNumInnovationSucceded;
	NumInnovationFailed = tmpNumInnovationFailed;
	NumProjectsSucceded = tmpNumProjectsSucceded;
	NumProjectsFailed = tmpNumProjectsFailed;
	NumTimeSelected = tmpNumTimeSelected;
	NumInnovationSuccededWithPartner = tmpNumInnovationSuccededWithPartner;
	NumInnovationFailedWithPartner = tmpNumInnovationFailedWithPartner;
	IDTempRequest = 0;
	BornStep = tmpBornStep;
}

Agent::~Agent()
{
}

bool Agent::GetStatus(Mil_Int tmpLowLevel) {
	if(Activity > tmpLowLevel)
		return true;
	else return false;
}

void Agent::PrintMe()
{
	cout << "Print Agent ID: " << ID << endl;
	cout << "\tActivity: " << Activity << endl;
	cout << "\tGoal: " << Goal << endl;
	cout << "\tNumInnovationSucceded: " << NumInnovationSucceded << endl;
	cout << "\tNumInnovationFailed: " << NumInnovationFailed << endl;
	cout << "\tNumInnovationSuccededWithPartner: " << NumInnovationSuccededWithPartner << endl;
	cout << "\tNumInnovationFailedWithPartner: " << NumInnovationFailedWithPartner << endl;
}

void Agent::PrintRelationship()
{
	cout << "Print Relationship Agent: " << ID << " -- [begin] --" << endl;
	
	for(Relationships::iterator TabRelationshipsIter = TabRelationships.begin(); TabRelationshipsIter != TabRelationships.end(); TabRelationshipsIter++)
		cout << "Ag: " << ID << " --> " << TabRelationshipsIter->second.GetIDAgentPartner() << endl;
	
	cout << "Print Relationship Agent: " << ID << " -- [end] --" << endl;
}

void Agent::PrintArtifactsKnowed()
{
	cout << "Print Artifact Knowed by agent: " << ID << " -- [begin] --" << endl;
	
	for(list<Mil_Int>::iterator LinkArtifactsKnowedIter = LinkArtifactsKnowed.begin(); LinkArtifactsKnowedIter != LinkArtifactsKnowed.end(); LinkArtifactsKnowedIter++)
		cout << "\tID" << *LinkArtifactsKnowedIter;
	cout << endl;
	
	cout << "Print Artifact Knowed by agent: " << ID << " -- [end] --" << endl;
}

